package com.cskaoyan.controller.storage;

import com.cskaoyan.bean.MarketStorage;
import com.cskaoyan.bean.common.BaseRespVo;
import com.cskaoyan.bean.vo.admin.promotion.AdminAdStorageVO;
import com.cskaoyan.service.admin.storage.StorageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import java.io.IOException;


/*
 * @Auther:王贲
 * @Date:2022/9/6
 * @Description: TODO 广告添加页面上传图片
 * @VERSON:1.8
 */
@RestController
@RequestMapping("admin/storage")
public class StorageController {


    @Autowired
    StorageService storageService;



    @PostMapping("create")
    public BaseRespVo createImage(MultipartFile file) throws IOException {
        //用文件上传方法将文件的数据封装到AdminAdStorageVO中响应出去
        MarketStorage storageVO = storageService.uploadFile(file);
        return BaseRespVo.ok(storageVO);
    }
}
